package tw.com.softleader.spring.service.impl;

import java.util.List;

import tw.com.softleader.spring.dao.SpringDao;
import tw.com.softleader.spring.service.SpringService;

public class SpringServiceImpl implements SpringService{

	/** inject測試用變數，在spring-service.xml中定義(字串)*/
	private String greetion;

	/** inject測試用變數，在spring-service.xml中定義(List)*/
	private List<String> vendors;
	
	private SpringDao springDao;
	
	@Override
	public String getHello(String name) {
		String vendorStr = "";
		for(String vendor : vendors){
			vendorStr += vendor + ";";
		}
		return vendorStr + " Say: " + greetion + " " + name;
	}

	public List<String> getAll(){
		return springDao.findAll();
	}
	
	public String getGreetion() {
		return greetion;
	}

	/** INJECT時， 必需透過此SET方法 */
	public void setGreetion(String greetion) {
		this.greetion = greetion;
	}

	public List<String> getVendors() {
		return vendors;
	}

	/** INJECT時， 必需透過此SET方法 */
	public void setVendors(List<String> vendors) {
		this.vendors = vendors;
	}

	public SpringDao getSpringDao() {
		return springDao;
	}

	/** INJECT時， 必需透過此SET方法 */
	public void setSpringDao(SpringDao springDao) {
		this.springDao = springDao;
	}

}
